#! /usr/bin/python

#! /usr/bin/python

import math

def solutions(n):
    r = 1
    diff = n
    if n%2 == 0: step = 1
    else: step = 2
    while(diff > 1):
	if n**2%diff == 0:
	   r += 1
	   #print x, (x*n)/(x-n)
        diff -= step
		
    return r

def isPrime(n):
    if n ==2 or n==3 or n==5 or n==7: return True
    if n%2 == 0 or n%3 == 0: return False
    for i in range(5, int(math.sqrt(n) + 1), 6):
	if n%i == 0 or n%(i+2) == 0: return False
    return True

MAX = 4* 10**6
primes = [2]
for i in range(3, 50, 2):
    if isPrime(i):
	primes.append(i)

print len(primes)

minimal = 10**9
for i in range(14):
    for j in range(13):
	for k in range(12):
	    n = 3**i * 5**j * 7**k
	    if n > MAX*2 + 10**6: break
	    if n > MAX*2:
	       if minimal > n: minimal = n
	       if n == 8037225: print n, i, j, k 
	    for l in range(11):
		n = 3**i * 5**j * 7**k * 9**l
        	if n > MAX*2 + 10**6: break
	        if n > MAX*2:
	           if minimal > n: minimal = n
	           if n == 8037225: print n, i, j, k, l 

print minimal

power = [(0,2,2,4), (2,2,2,3), (4,2,2,2), (6,2,2,1), (8,2,2, 0)]

minimal = 10**150
for (a, b, c, d) in power:
    n = 1
    i = 0
    for i in range(d):
	n *= primes[i]**4

    for i in range(d, d+c):
	n *= primes[i]**3

    for i in range(d+c, d+c+b):
	n *= primes[i]**2

    for i in range(d+c+b, d+c+b+a):
	n *= primes[i]
    if minimal > n: minimal = n

print minimal

